<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>CryptoAuthLib: atca_basic_aes_gcm.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">CryptoAuthLib
   </div>
   <div id="projectbrief">Microchip CryptoAuthentication Library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('a00242.html','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a>  </div>
  <div class="headertitle">
<div class="title">atca_basic_aes_gcm.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Unity tests for the cryptoauthlib AES GCM functions.  
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &quot;<a class="el" href="a00359_source.html">cryptoauthlib.h</a>&quot;</code><br />
</div>
<p><a href="a00242_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a01085.html">atca_aes_gcm_ctx</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac77c63c0685b2cce6a89f607ea019065"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="a01085.html">atca_aes_gcm_ctx</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00242.html#ac77c63c0685b2cce6a89f607ea019065">atca_aes_gcm_ctx_t</a></td></tr>
<tr class="separator:ac77c63c0685b2cce6a89f607ea019065"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa5990c6c2a55759960d25a1f8ad1973d"><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00991.html#gaa5990c6c2a55759960d25a1f8ad1973d">atca_basic_aes_gcm_version</a></td></tr>
<tr class="separator:gaa5990c6c2a55759960d25a1f8ad1973d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4805112b62e86b5465e24648504dc374"><td class="memItemLeft" align="right" valign="top"><a class="el" href="a00173.html#a22bd6643f31f1d75dc3e7ea939f468cd">ATCA_STATUS</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00242.html#a4805112b62e86b5465e24648504dc374">atcab_aes_gcm_init</a> (<a class="el" href="a00242.html#ac77c63c0685b2cce6a89f607ea019065">atca_aes_gcm_ctx_t</a> *ctx, uint16_t key_id, uint8_t key_block, const uint8_t *iv, size_t iv_size)</td></tr>
<tr class="memdesc:a4805112b62e86b5465e24648504dc374"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize context for AES GCM operation with an existing IV, which is common when starting a decrypt operation.  <a href="#a4805112b62e86b5465e24648504dc374">More...</a><br /></td></tr>
<tr class="separator:a4805112b62e86b5465e24648504dc374"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad71a5720ceaddf2c76476aead5f0c3e6"><td class="memItemLeft" align="right" valign="top"><a class="el" href="a00173.html#a22bd6643f31f1d75dc3e7ea939f468cd">ATCA_STATUS</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00242.html#ad71a5720ceaddf2c76476aead5f0c3e6">atcab_aes_gcm_init_rand</a> (<a class="el" href="a00242.html#ac77c63c0685b2cce6a89f607ea019065">atca_aes_gcm_ctx_t</a> *ctx, uint16_t key_id, uint8_t key_block, size_t rand_size, const uint8_t *free_field, size_t free_field_size, uint8_t *iv)</td></tr>
<tr class="memdesc:ad71a5720ceaddf2c76476aead5f0c3e6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize context for AES GCM operation with a IV composed of a random and optional fixed(free) field, which is common when starting an encrypt operation.  <a href="#ad71a5720ceaddf2c76476aead5f0c3e6">More...</a><br /></td></tr>
<tr class="separator:ad71a5720ceaddf2c76476aead5f0c3e6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1d6fd831a8125a366504a0ab77b62da8"><td class="memItemLeft" align="right" valign="top"><a class="el" href="a00173.html#a22bd6643f31f1d75dc3e7ea939f468cd">ATCA_STATUS</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00242.html#a1d6fd831a8125a366504a0ab77b62da8">atcab_aes_gcm_aad_update</a> (<a class="el" href="a00242.html#ac77c63c0685b2cce6a89f607ea019065">atca_aes_gcm_ctx_t</a> *ctx, const uint8_t *aad, uint32_t aad_size)</td></tr>
<tr class="memdesc:a1d6fd831a8125a366504a0ab77b62da8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Process Additional Authenticated Data (AAD) using GCM mode and a key within the ATECC608A device.  <a href="#a1d6fd831a8125a366504a0ab77b62da8">More...</a><br /></td></tr>
<tr class="separator:a1d6fd831a8125a366504a0ab77b62da8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab3fda8219d17d1b7bc50b1040399a47d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="a00173.html#a22bd6643f31f1d75dc3e7ea939f468cd">ATCA_STATUS</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00242.html#ab3fda8219d17d1b7bc50b1040399a47d">atcab_aes_gcm_encrypt_update</a> (<a class="el" href="a00242.html#ac77c63c0685b2cce6a89f607ea019065">atca_aes_gcm_ctx_t</a> *ctx, const uint8_t *plaintext, uint32_t plaintext_size, uint8_t *ciphertext)</td></tr>
<tr class="memdesc:ab3fda8219d17d1b7bc50b1040399a47d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Encrypt data using GCM mode and a key within the ATECC608A device. <a class="el" href="a00991.html#ga4805112b62e86b5465e24648504dc374" title="Initialize context for AES GCM operation with an existing IV, which is common when starting a decrypt...">atcab_aes_gcm_init()</a> or <a class="el" href="a00991.html#gad71a5720ceaddf2c76476aead5f0c3e6" title="Initialize context for AES GCM operation with a IV composed of a random and optional fixed(free) fiel...">atcab_aes_gcm_init_rand()</a> should be called before the first use of this function.  <a href="#ab3fda8219d17d1b7bc50b1040399a47d">More...</a><br /></td></tr>
<tr class="separator:ab3fda8219d17d1b7bc50b1040399a47d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ada2d38835826587970de3868ca48eaa4"><td class="memItemLeft" align="right" valign="top"><a class="el" href="a00173.html#a22bd6643f31f1d75dc3e7ea939f468cd">ATCA_STATUS</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00242.html#ada2d38835826587970de3868ca48eaa4">atcab_aes_gcm_encrypt_finish</a> (<a class="el" href="a00242.html#ac77c63c0685b2cce6a89f607ea019065">atca_aes_gcm_ctx_t</a> *ctx, uint8_t *tag, size_t tag_size)</td></tr>
<tr class="memdesc:ada2d38835826587970de3868ca48eaa4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Complete a GCM encrypt operation returning the authentication tag.  <a href="#ada2d38835826587970de3868ca48eaa4">More...</a><br /></td></tr>
<tr class="separator:ada2d38835826587970de3868ca48eaa4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2ad3270d8bebf6172dc02d0c7d9fb738"><td class="memItemLeft" align="right" valign="top"><a class="el" href="a00173.html#a22bd6643f31f1d75dc3e7ea939f468cd">ATCA_STATUS</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00242.html#a2ad3270d8bebf6172dc02d0c7d9fb738">atcab_aes_gcm_decrypt_update</a> (<a class="el" href="a00242.html#ac77c63c0685b2cce6a89f607ea019065">atca_aes_gcm_ctx_t</a> *ctx, const uint8_t *ciphertext, uint32_t ciphertext_size, uint8_t *plaintext)</td></tr>
<tr class="memdesc:a2ad3270d8bebf6172dc02d0c7d9fb738"><td class="mdescLeft">&#160;</td><td class="mdescRight">Decrypt data using GCM mode and a key within the ATECC608A device. <a class="el" href="a00991.html#ga4805112b62e86b5465e24648504dc374" title="Initialize context for AES GCM operation with an existing IV, which is common when starting a decrypt...">atcab_aes_gcm_init()</a> or <a class="el" href="a00991.html#gad71a5720ceaddf2c76476aead5f0c3e6" title="Initialize context for AES GCM operation with a IV composed of a random and optional fixed(free) fiel...">atcab_aes_gcm_init_rand()</a> should be called before the first use of this function.  <a href="#a2ad3270d8bebf6172dc02d0c7d9fb738">More...</a><br /></td></tr>
<tr class="separator:a2ad3270d8bebf6172dc02d0c7d9fb738"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa86508958ff3d81f9bd8e79344537218"><td class="memItemLeft" align="right" valign="top"><a class="el" href="a00173.html#a22bd6643f31f1d75dc3e7ea939f468cd">ATCA_STATUS</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00242.html#aa86508958ff3d81f9bd8e79344537218">atcab_aes_gcm_decrypt_finish</a> (<a class="el" href="a00242.html#ac77c63c0685b2cce6a89f607ea019065">atca_aes_gcm_ctx_t</a> *ctx, const uint8_t *tag, size_t tag_size, bool *is_verified)</td></tr>
<tr class="memdesc:aa86508958ff3d81f9bd8e79344537218"><td class="mdescLeft">&#160;</td><td class="mdescRight">Complete a GCM decrypt operation verifying the authentication tag.  <a href="#aa86508958ff3d81f9bd8e79344537218">More...</a><br /></td></tr>
<tr class="separator:aa86508958ff3d81f9bd8e79344537218"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Unity tests for the cryptoauthlib AES GCM functions. </p>
<dl class="section copyright"><dt>Copyright</dt><dd>(c) 2015-2018 Microchip Technology Inc. and its subsidiaries. </dd></dl>
</div><h2 class="groupheader">Typedef Documentation</h2>
<a id="ac77c63c0685b2cce6a89f607ea019065"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac77c63c0685b2cce6a89f607ea019065">&#9670;&nbsp;</a></span>atca_aes_gcm_ctx_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef struct <a class="el" href="a01085.html">atca_aes_gcm_ctx</a>  <a class="el" href="a00242.html#ac77c63c0685b2cce6a89f607ea019065">atca_aes_gcm_ctx_t</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Context structure for AES GCM operations. </p>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="a1d6fd831a8125a366504a0ab77b62da8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1d6fd831a8125a366504a0ab77b62da8">&#9670;&nbsp;</a></span>atcab_aes_gcm_aad_update()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="a00173.html#a22bd6643f31f1d75dc3e7ea939f468cd">ATCA_STATUS</a> atcab_aes_gcm_aad_update </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="a00242.html#ac77c63c0685b2cce6a89f607ea019065">atca_aes_gcm_ctx_t</a> *&#160;</td>
          <td class="paramname"><em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>aad</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>aad_size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Process Additional Authenticated Data (AAD) using GCM mode and a key within the ATECC608A device. </p>
<p>This can be called multiple times. <a class="el" href="a00991.html#ga4805112b62e86b5465e24648504dc374" title="Initialize context for AES GCM operation with an existing IV, which is common when starting a decrypt...">atcab_aes_gcm_init()</a> or <a class="el" href="a00991.html#gad71a5720ceaddf2c76476aead5f0c3e6" title="Initialize context for AES GCM operation with a IV composed of a random and optional fixed(free) fiel...">atcab_aes_gcm_init_rand()</a> should be called before the first use of this function. When there is AAD to include, this should be called before <a class="el" href="a00991.html#gab3fda8219d17d1b7bc50b1040399a47d" title="Encrypt data using GCM mode and a key within the ATECC608A device. atcab_aes_gcm_init() or atcab_aes_...">atcab_aes_gcm_encrypt_update()</a> or <a class="el" href="a00991.html#ga2ad3270d8bebf6172dc02d0c7d9fb738" title="Decrypt data using GCM mode and a key within the ATECC608A device. atcab_aes_gcm_init() or atcab_aes_...">atcab_aes_gcm_decrypt_update()</a>.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">ctx</td><td>AES GCM context </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">aad</td><td>Additional authenticated data to be added </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">aad_size</td><td>Size of aad in bytes</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>ATCA_SUCCESS on success, otherwise an error code. </dd></dl>

</div>
</div>
<a id="aa86508958ff3d81f9bd8e79344537218"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa86508958ff3d81f9bd8e79344537218">&#9670;&nbsp;</a></span>atcab_aes_gcm_decrypt_finish()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="a00173.html#a22bd6643f31f1d75dc3e7ea939f468cd">ATCA_STATUS</a> atcab_aes_gcm_decrypt_finish </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="a00242.html#ac77c63c0685b2cce6a89f607ea019065">atca_aes_gcm_ctx_t</a> *&#160;</td>
          <td class="paramname"><em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>tag</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>tag_size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool *&#160;</td>
          <td class="paramname"><em>is_verified</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Complete a GCM decrypt operation verifying the authentication tag. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">ctx</td><td>AES GCM context structure. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">tag</td><td>Expected authentication tag. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">tag_size</td><td>Size of tag in bytes (12 to 16 bytes). </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">is_verified</td><td>Returns whether or not the tag verified.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>ATCA_SUCCESS on success, otherwise an error code. </dd></dl>

</div>
</div>
<a id="a2ad3270d8bebf6172dc02d0c7d9fb738"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2ad3270d8bebf6172dc02d0c7d9fb738">&#9670;&nbsp;</a></span>atcab_aes_gcm_decrypt_update()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="a00173.html#a22bd6643f31f1d75dc3e7ea939f468cd">ATCA_STATUS</a> atcab_aes_gcm_decrypt_update </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="a00242.html#ac77c63c0685b2cce6a89f607ea019065">atca_aes_gcm_ctx_t</a> *&#160;</td>
          <td class="paramname"><em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>ciphertext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>ciphertext_size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>plaintext</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Decrypt data using GCM mode and a key within the ATECC608A device. <a class="el" href="a00991.html#ga4805112b62e86b5465e24648504dc374" title="Initialize context for AES GCM operation with an existing IV, which is common when starting a decrypt...">atcab_aes_gcm_init()</a> or <a class="el" href="a00991.html#gad71a5720ceaddf2c76476aead5f0c3e6" title="Initialize context for AES GCM operation with a IV composed of a random and optional fixed(free) fiel...">atcab_aes_gcm_init_rand()</a> should be called before the first use of this function. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">ctx</td><td>AES GCM context structure. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">ciphertext</td><td>Ciphertext to be decrypted. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">ciphertext_size</td><td>Size of ciphertext in bytes. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">plaintext</td><td>Decrypted data is returned here.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>ATCA_SUCCESS on success, otherwise an error code. </dd></dl>

</div>
</div>
<a id="ada2d38835826587970de3868ca48eaa4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ada2d38835826587970de3868ca48eaa4">&#9670;&nbsp;</a></span>atcab_aes_gcm_encrypt_finish()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="a00173.html#a22bd6643f31f1d75dc3e7ea939f468cd">ATCA_STATUS</a> atcab_aes_gcm_encrypt_finish </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="a00242.html#ac77c63c0685b2cce6a89f607ea019065">atca_aes_gcm_ctx_t</a> *&#160;</td>
          <td class="paramname"><em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>tag</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>tag_size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Complete a GCM encrypt operation returning the authentication tag. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">ctx</td><td>AES GCM context structure. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">tag</td><td>Authentication tag is returned here. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">tag_size</td><td>Tag size in bytes (12 to 16 bytes).</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>ATCA_SUCCESS on success, otherwise an error code. </dd></dl>

</div>
</div>
<a id="ab3fda8219d17d1b7bc50b1040399a47d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab3fda8219d17d1b7bc50b1040399a47d">&#9670;&nbsp;</a></span>atcab_aes_gcm_encrypt_update()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="a00173.html#a22bd6643f31f1d75dc3e7ea939f468cd">ATCA_STATUS</a> atcab_aes_gcm_encrypt_update </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="a00242.html#ac77c63c0685b2cce6a89f607ea019065">atca_aes_gcm_ctx_t</a> *&#160;</td>
          <td class="paramname"><em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>plaintext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>plaintext_size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>ciphertext</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Encrypt data using GCM mode and a key within the ATECC608A device. <a class="el" href="a00991.html#ga4805112b62e86b5465e24648504dc374" title="Initialize context for AES GCM operation with an existing IV, which is common when starting a decrypt...">atcab_aes_gcm_init()</a> or <a class="el" href="a00991.html#gad71a5720ceaddf2c76476aead5f0c3e6" title="Initialize context for AES GCM operation with a IV composed of a random and optional fixed(free) fiel...">atcab_aes_gcm_init_rand()</a> should be called before the first use of this function. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">ctx</td><td>AES GCM context structure. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">plaintext</td><td>Plaintext to be encrypted (16 bytes). </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">plaintext_size</td><td>Size of plaintext in bytes. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">ciphertext</td><td>Encrypted data is returned here.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>ATCA_SUCCESS on success, otherwise an error code. </dd></dl>

</div>
</div>
<a id="a4805112b62e86b5465e24648504dc374"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4805112b62e86b5465e24648504dc374">&#9670;&nbsp;</a></span>atcab_aes_gcm_init()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="a00173.html#a22bd6643f31f1d75dc3e7ea939f468cd">ATCA_STATUS</a> atcab_aes_gcm_init </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="a00242.html#ac77c63c0685b2cce6a89f607ea019065">atca_aes_gcm_ctx_t</a> *&#160;</td>
          <td class="paramname"><em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>key_id</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>key_block</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>iv</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>iv_size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initialize context for AES GCM operation with an existing IV, which is common when starting a decrypt operation. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">ctx</td><td>AES GCM context to be initialized. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">key_id</td><td>Key location. Can either be a slot number or ATCA_TEMPKEY_KEYID for TempKey. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">key_block</td><td>Index of the 16-byte block to use within the key location for the actual key. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">iv</td><td>Initialization vector. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">iv_size</td><td>Size of IV in bytes. Standard is 12 bytes.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>ATCA_SUCCESS on success, otherwise an error code. </dd></dl>

</div>
</div>
<a id="ad71a5720ceaddf2c76476aead5f0c3e6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad71a5720ceaddf2c76476aead5f0c3e6">&#9670;&nbsp;</a></span>atcab_aes_gcm_init_rand()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="a00173.html#a22bd6643f31f1d75dc3e7ea939f468cd">ATCA_STATUS</a> atcab_aes_gcm_init_rand </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="a00242.html#ac77c63c0685b2cce6a89f607ea019065">atca_aes_gcm_ctx_t</a> *&#160;</td>
          <td class="paramname"><em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>key_id</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>key_block</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>rand_size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>free_field</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>free_field_size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>iv</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initialize context for AES GCM operation with a IV composed of a random and optional fixed(free) field, which is common when starting an encrypt operation. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">ctx</td><td>AES CTR context to be initialized. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">key_id</td><td>Key location. Can either be a slot number or ATCA_TEMPKEY_KEYID for TempKey. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">key_block</td><td>Index of the 16-byte block to use within the key location for the actual key. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">rand_size</td><td>Size of the random field in bytes. Minimum and recommended size is 12 bytes. Max is 32 bytes. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">free_field</td><td>Fixed data to include in the IV after the random field. Can be NULL if not used. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">free_field_size</td><td>Size of the free field in bytes. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">iv</td><td>Initialization vector is returned here. Its size will be rand_size and free_field_size combined.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>ATCA_SUCCESS on success, otherwise an error code. </dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_97aefd0d527b934f1d99a682da8fe6a9.html">lib</a></li><li class="navelem"><a class="el" href="dir_f987fb6e7cf85d8e48d70ffe78b3ebc1.html">basic</a></li><li class="navelem"><a class="el" href="a00242.html">atca_basic_aes_gcm.h</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.15 </li>
  </ul>
</div>
</body>
</html>
